package com.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * DangOrder entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "dang_order", catalog = "dangdang")
public class DangOrder implements java.io.Serializable {
	private static final long serialVersionUID = 1L;
	private Integer id;
	private ReceiveAddress receiveAddress;
	private Double totalPrice;

	// Constructors

	/** default constructor */
	public DangOrder() {
	}

	/** full constructor */
	public DangOrder(ReceiveAddress receiveAddress, Double totalPrice) {
		this.receiveAddress = receiveAddress;
		this.totalPrice = totalPrice;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "address_id")
	public ReceiveAddress getReceiveAddress() {
		return this.receiveAddress;
	}

	public void setReceiveAddress(ReceiveAddress receiveAddress) {
		this.receiveAddress = receiveAddress;
	}

	@Column(name = "total_price", precision = 22, scale = 0)
	public Double getTotalPrice() {
		return this.totalPrice;
	}

	public void setTotalPrice(Double totalPrice) {
		this.totalPrice = totalPrice;
	}

}